/* Copyright (c) 2013, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
 * only version 2 as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 */

&soc {
	serial@f991e000 {
		status = "ok";
	};

	i2c@f9923000 {
		ist30xx_ts@50 {
			compatible = "imagis,ist30xx-ts";
			reg = <0x50>;
			interrupt-parent = <&msmgpio>;
			interrupts = <1 0>;
			vdd_en-gpio = <&msmgpio 77 0x01>;
			vdd_ana-supply = <&pm8110_l19>;
			vcc_i2c-supply = <&pm8110_l6>;
			imagis,sda-gpio = <&msmgpio 2 0x00>;
			imagis,scl-gpio = <&msmgpio 3 0x00>;
			imagis,irq-gpio = <&msmgpio 1 0x00>;
			imagis,i2c-pull-up = <1>;
		};
	};

	i2c@f9925000{
		gp2a-i2c@44{
			compatible = "gp2a-i2c";
			reg = <0x44>;
			interrupt-parent = <&msmgpio>;
			interupts= <80 0>;
			gp2a-i2c,irq-gpio = <&msmgpio 80 0x00>;
			gp2a-i2c,en-gpio = <&msmgpio 98 0x00>;
			gp2a-vio-supply = <&pm8110_l6>;
		};
		bma254@18{
			compatible = "bma254";
			reg = <0x18>;
			interrupt-parent = <&msmgpio>;
			interupts= <34 0>;
			bma254,irq-gpio = <&msmgpio 34 0x00>;
			bma254,position = <4>;
			bma254-vdd-supply = <&pm8110_l6>;
		};
	};

	i2c@19{
		cell-index = <19>;
		compatible = "i2c-gpio";
		gpios = <&msmgpio 86 0 /* sda */
			&msmgpio 87 0 /* scl */
			>;
		i2c-gpio,delay-us = <2>;
		#address-cells = <1>;
		#size-cells = <0>;

		sec-fuelgauge@36 {
			compatible = "sec-fuelgauge,i2c";
			reg = <0x36>;
			fuelgauge,fuel_int = <&msmgpio 91 0x1>;
			qcom,sec-fuelgauge-vadc = <&pm8110_vadc>;
			fuelgauge,bat_int = <&msmgpio 32 0x1>;
			fuelgauge,capacity_max = <1000>;
			fuelgauge,capacity_max_margin = <50>;
			fuelgauge,capacity_min = <0>;
			fuelgauge,capacity_calculation_type = <0x17>;
			fuelgauge,fuel_alert_soc = <2>;
			fuelgauge,rcomp0 = <0x6f>;
			fuelgauge,rcomp_charging = <0x66>;
			fuelgauge,is_using_model_data;
			fuelgauge,type_str = "SDI";
		};
		smb358@6A {
			compatible = "smb358,i2c";
			reg = <0x6A>;
		};
	};

	battery {
		status = "okay";
		compatible = "samsung,sec-battery";
		battery,vendor = "SDI SDI";
		battery,charger_name = "smb358";
		battery,fuelgauge_name = "sec-fuelgauge";
		battery,technology = <2>; /* POWER_SUPPLY_TECHNOLOGY_LION */
		/*battery,ta_int = <&pm8941_gpios 29 0x1>;*/
		/*battery,ta_irq_attr = <0x3>;*/
		battery,bat_int = <&msmgpio 32 0x1>;
		battery,bat_irq_attr = <0x3>;
		battery,chip_vendor = "QCOM";
		battery,temp_adc_type = <1>; /* SEC_BATTERY_ADC_TYPE_AP */
		battery,polling_time = <10 30 30 30 3600>;
		battery,adc_check_count = <6>;
		battery,cable_check_type = <4>;  /* SEC_BATTERY_CABLE_CHECK_PSY */
		battery,cable_source_type = <9>; /* SEC_BATTERY_CABLE_SOURCE_EXTERNAL | SEC_BATTERY_CABLE_SOURCE_EXTENDED */
		battery,event_check;
		battery,event_waiting_time = <600>;
		battery,polling_type = <1>; /* SEC_BATTERY_MONITOR_ALARM */
		battery,monitor_initial_count = <3>;
		battery,battery_check_type = <6>; /* SEC_BATTERY_CHECK_INT */
		battery,check_count = <0>;
		battery,check_adc_max = <1440>;
		battery,check_adc_min = <0>;
		battery,ovp_uvlo_check_type = <3>; /* SEC_BATTERY_OVP_UVLO_CHGPOLLING */
		battery,thermal_source = <2>; /*SEC_BATTERY_THERMAL_SOURCE_ADC*/
		battery,temp_table_adc = <27281 27669 28178 28724 29342 30101 30912 31807 32823 33858 34950 36049 37054
			38025 38219 38448 38626 38795 38989 39229 39540 39687 39822 40523 41123 41619>;
		battery,temp_table_data = <700 650 600 550 500 450 400 350 300 250 200 150 100
			50 40 30 20 10 0 (-10) (-30) (-40) (-50) (-100) (-150) (-200)>;
		battery,temp_check_type = <2>; /* SEC_BATTERY_TEMP_CHECK_TEMP */
		battery,temp_check_count = <1>;
		battery,temp_high_threshold_event = <650>;
		battery,temp_high_recovery_event = <440>;
		battery,temp_low_threshold_event = <(-45)>;
		battery,temp_low_recovery_event = <10>;
		battery,temp_high_threshold_normal = <650>;
		battery,temp_high_recovery_normal = <440>;
		battery,temp_low_threshold_normal = <(-45)>;
		battery,temp_low_recovery_normal = <10>;
		battery,temp_high_threshold_lpm = <650>;
		battery,temp_high_recovery_lpm = <440>;
		battery,temp_low_threshold_lpm = <(-45)>;
		battery,temp_low_recovery_lpm = <10>;
		battery,full_check_type = <7>;     /* SEC_BATTERY_FULLCHARGED_CHGPSY */
		battery,full_check_type_2nd = <3>;      /* SEC_BATTERY_FULLCHARGED_TIME */
		battery,full_check_count = <1>;
		battery,chg_gpio_full_check = <0>;
		battery,chg_polarity_full_check = <1>;
		battery,full_condition_type = <13>;
		battery,full_condition_soc = <97>;
		battery,full_condition_vcell = <4300>;
		battery,recharge_check_count = <1>;
		battery,recharge_condition_type = <4>;/* SEC_BATTERY_RECHARGE_CONDITION_VCELL*/
		battery,recharge_condition_soc = <98>;
		battery,recharge_condition_avgvcell = <4300>;
		battery,recharge_condition_vcell = <4300>;
		battery,charging_total_time = <21600>;
		battery,recharging_total_time = <5400>;
		battery,charging_reset_time = <0>;

		charger {
			status = "disabled";
			/* Charger */
			battery,charger_name = "smb358,i2c";
			battery,chg_gpio_en = <0>;
			battery,chg_polarity_en = <0>;
			battery,chg_gpio_status = <0>;
			battery,chg_polarity_status = <0>;
			battery,chg_float_voltage = <4340>;
			battery,ovp_uvlo_check_type = <3>; /* SEC_BATTERY_OVP_UVLO_CHGPOLLING */
			battery,full_check_type = <7>; /*SEC_BATTERY_FULLCHARGED_CHGPSY */

			battery,input_current_limit = <700 460 460 700 460 700 700 460 700 460 650 700 460 460 700 700 700 300 700 700 460 460>;
			battery,fast_charging_current = <700 0 460 700 460 700 700 460 700 0 700 700 0 0 700 0 0 300 700 700 0 0>;
			battery,full_check_current_1st = <125 0 125 125 125 125 125 125 125 0 125 125 0 0 125 0 0 125 125 125 0 0>;
			battery,full_check_current_2nd = <2400 0 2400 2400 2400 2400 2400 2400 2400 2400 0 2400 0 0 2400 2400 2400 2400 2400 2400 0 0>;
		};
	};
	samsung,vibrator{
		compatible = "vibrator";
		samsung,motor-en = <&msmgpio 0 0x00>;
		status = "ok";
	};


	gen-vkeys {
		compatible = "qcom,gen-vkeys";
		label = "atmel_mxt_ts";
		qcom,disp-maxx = <480>;
		qcom,disp-maxy = <800>;
		qcom,panel-maxx = <508>;
		qcom,panel-maxy = <880>;
		qcom,key-codes = <158 102 139>;
		qcom,y-offset = <35>;
	};

	gpio_keys {
		compatible = "gpio-keys";
		input-name = "gpio-keys";

		vol_up {
			label = "volume_up";
			gpios = <&msmgpio 72 0x1>;
			linux,input-type = <1>;
			linux,code = <115>;
			gpio-key,wakeup;
			debounce-interval = <15>;
		};

		vol_down {
			label = "volume_down";
			gpios = <&msmgpio 73 0x1>;
			linux,input-type = <1>;
			linux,code = <114>;
			gpio-key,wakeup;
			debounce-interval = <15>;
		};

		home_key {
			label = "home_key";
			gpios = <&msmgpio 74 0x1>;
			linux,input-type = <1>;
			linux,code = <172>;
			gpio-key,wakeup;
			debounce-interval = <15>;
		};
	};

    sound {
        qcom,audio-routing =
            "RX_BIAS", "MCLK",
            "INT_LDO_H", "MCLK",
            "MIC BIAS External", "Handset Mic",
            "MIC BIAS Internal2", "Headset Mic",
            "MIC BIAS External", "Sub Mic",
            "AMIC1", "MIC BIAS External",
            "AMIC2", "MIC BIAS Internal2",
            "AMIC3", "MIC BIAS External";
    };
    
    earjack {
        compatible = "sec_jack";
        qcom,earjack-detect-gpio = <&msmgpio 84 0>;
        qcom,earjack-sendend-gpio = <&msmgpio 101 0>;
        qcom,earjack-micbias-gpio = <&msmgpio 90 0>;
        qcom,earjack-vadc = <&pm8110_vadc>;

        det-zones-list = <&det_zones 3 10000 10 0>,
            <&det_zones 975 10000 10 0>,
            <&det_zones 1679 10000 10 1>,
            <&det_zones 9999 10000 10 1>;
        but-zones-list = <&but_zones 0 0 162>,
            <&but_zones 1 163 325>,
            <&but_zones 2 326 700>;
        mpp-channel-scaling = <2 1 3>;
    };
};

&i2c_cdc  {
	msm8x10_wcd_codec@0d{
		compatible = "qcom,msm8x10-wcd-i2c";
		reg = <0x0d>;

		interrupt-parent = <&wcd9xxx_intc>;
		interrupts = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
						17 18 19 20 21 22 23>;

		cdc-vdda-cp-supply = <&pm8110_s4>;
		qcom,cdc-vdda-cp-voltage = <1800000 2150000>;
		qcom,cdc-vdda-cp-current = <650000>;

		cdc-vdda-h-supply = <&pm8110_l6>;
		qcom,cdc-vdda-h-voltage = <1800000 1800000>;
		qcom,cdc-vdda-h-current = <25000>;

		cdc-vdd-px-supply = <&pm8110_l6>;
		qcom,cdc-vdd-px-voltage = <1800000 1800000>;
		qcom,cdc-vdd-px-current = <10000>;

		cdc-vdd-1p2v-supply = <&pm8110_l4>;
		qcom,cdc-vdd-1p2v-voltage = <1200000 1200000>;
		qcom,cdc-vdd-1p2v-current = <5000>;

		cdc-vdd-mic-bias-supply = <&pm8110_l20>;
		qcom,cdc-vdd-mic-bias-voltage = <3075000 3075000>;
		qcom,cdc-vdd-mic-bias-current = <25000>;

		qcom,cdc-micbias-ldoh-v = <0x3>;
		qcom,cdc-micbias-cfilt-sel = <0x0>;
		qcom,cdc-micbias-cfilt-mv = <2700>;
		qcom,cdc-mclk-clk-rate = <12288000>;

		qcom,cdc-static-supplies = "cdc-vdda-h",
					   "cdc-vdd-px",
					   "cdc-vdd-1p2v";

		qcom,cdc-on-demand-supplies = "cdc-vdda-cp",
					      "cdc-vdd-mic-bias";
	};

	msm8x10_wcd_codec@77{
		compatible = "qcom,msm8x10-wcd-i2c";
		reg = <0x77>;
	};

	msm8x10_wcd_codec@66{
		compatible = "qcom,msm8x10-wcd-i2c";
		reg = <0x66>;
	};

	msm8x10_wcd_codec@55{
		compatible = "qcom,msm8x10-wcd-i2c";
		reg = <0x55>;
	};
};

&spmi_bus {
	qcom,pm8110@0 {
		qcom,leds@a100 {
			status = "disabled";
			qcom,led_mpp_2 {
				label = "mpp";
				linux,name = "button-backlight";
				linux-default-trigger = "hr-trigger";
				qcom,default-state = "off";
				qcom,max-current = <40>;
				qcom,id = <6>;
				qcom,source-sel = <1>;
				qcom,mode-ctrl = <0x60>;
				qcom,mode = "manual";
			};
		};

		qcom,leds@a200 {
			status = "okay";
			qcom,led_mpp_3 {
				label = "mpp";
				linux,name = "wled-backlight";
				linux,default-trigger = "bkl-trigger";
				qcom,default-state = "on";
				qcom,max-current = <40>;
				qcom,id = <6>;
				qcom,source-sel = <1>;
				qcom,mode-ctrl = <0x10>;
				qcom,mode = "manual";
			};
		};
	};
};

&spmi_bus {
	qcom,pm8110@1 {
		qcom,vibrator@c000 {
			status = "disabled";
		};
	};
};

&sdhc_1 {
	vdd-supply = <&pm8110_l17>;
	qcom,vdd-always-on;
	qcom,vdd-lpm-sup;
	qcom,vdd-voltage-level = <2900000 2900000>;
	qcom,vdd-current-level = <200 400000>;

	vdd-io-supply = <&pm8110_l6>;
	qcom,vdd-io-always-on;
	qcom,vdd-io-lpm-sup;
	qcom,vdd-io-voltage-level = <1800000 1800000>;
	qcom,vdd-io-current-level = <200 60000>;

	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */

	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;
	qcom,bus-speed-mode = "HS200_1p8v", "DDR_1p8v";
	qcom,nonremovable;

	status = "ok";
};

&sdhc_2 {
	vdd-supply = <&pm8110_l18>;
	qcom,vdd-voltage-level = <2950000 2950000>;
	qcom,vdd-current-level = <15000 400000>;

	vdd-io-supply = <&pm8110_l21>;
	qcom,vdd-io-voltage-level = <1800000 2950000>;
	qcom,vdd-io-current-level = <200 50000>;

	qcom,pad-pull-on = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
	qcom,pad-pull-off = <0x0 0x3 0x3>; /* no-pull, pull-up, pull-up */
	qcom,pad-drv-on = <0x4 0x4 0x4>; /* 10mA, 10mA, 10mA */
	qcom,pad-drv-off = <0x0 0x0 0x0>; /* 2mA, 2mA, 2mA */

	qcom,clk-rates = <400000 25000000 50000000 100000000 200000000>;

	#address-cells = <0>;
	interrupt-parent = <&sdhc_2>;
	interrupts = <0 1 2>;
	#interrupt-cells = <1>;
	interrupt-map-mask = <0xffffffff>;
	interrupt-map = <0 &intc 0 125 0
			1 &intc 0 221 0
			2 &msmgpio 42 0x3>;
	interrupt-names = "hc_irq", "pwr_irq", "status_irq";
	cd-gpios = <&msmgpio 42 0x1>;

	status = "ok";
};

&pm8110_chg {
	status = "ok";

	qcom,chgr@1000 {
		status = "ok";
	};

	qcom,buck@1100 {
		status = "ok";
	};

	qcom,bat-if@1200 {
		status = "ok";
	};

	qcom,usb-chgpth@1300 {
		status = "ok";
	};

	qcom,chg-misc@1600 {
		status = "ok";
	};
};

&pm8110_gpios {
	gpio@c000 { /* GPIO 1 */
	};

	gpio@c100 { /* GPIO 2 */
	};

	gpio@c200 { /* GPIO 3 */
	};

	gpio@c300 { /* GPIO 4 */
	};
};

&pm8110_mpps {
	mpp@a000 { /* MPP 1 */
	};

	mpp@a100 { /* MPP 2 */
		status = "ok";
		qcom,mode = <4>; // AIN input
		qcom,invert = <0>; //No Invert
		qcom,output-type = <0>; //CMOS
		qcom,vin-sel = <2>; //PM8971_S3 1.8v
		qcom,src-sel = <0>; //MPP Constant
		qcom,ain-route = <1>; // QPNP_PIN_AIN_AMUX_CH6 = 1 for MPP2
		qcom,master-en = <1>; // Function constant
	};

	/* Backlight temp code */
	mpp@a200 { /* MPP 3 */
		qcom,mode = <1>; /* DIG_OUT */
		qcom,invert = <1>; /* 0: Low, 1: High */
		qcom,output-type = <0>; /* CMOS */
		qcom,vin-sel = <2>; /* Voltage Setting */
		qcom,src-sel = <0>; /* CONSTANT */
		qcom,out-strength = <1>; /* QPNP_PIN_OUT_STRENGTH_LOW */
		qcom,master-en = <1>; /* ENABLE MPP */
	};

	mpp@a300 { /* MPP 4 */
		/* PA_THERM config */
		qcom,mode = <4>; /* AIN input */

		qcom,invert = <1>; /* Enable MPP */
		qcom,ain-route = <3>; /* AMUX 8 */
		qcom,master-en = <1>;
		qcom,src-sel = <0>; /* Function constant */
	};
};

&pm8110_bms {
	status = "ok";
};

&mdss_mdp {
	qcom,mdss-pref-prim-intf = "dsi";
};

/*
&mdss_dsi0 {
	qcom,dsi-pref-prim-pan = <&dsi_nt35510_wvga_cmd>;
};

&dsi_nt35510_wvga_cmd {
	qcom,cont-splash-enabled;
};
*/

